package com.syh.jn.scm.domain.downstream.repository.purchase;

import com.syh.core.ddd.infrastructure.repository.AggregateRepository;
import com.syh.jn.scm.domain.downstream.entity.purchase.DownPurchaseOrder;
import com.syh.jn.scm.domain.downstream.entity.purchase.DownPurchaseOrderItem;


/**
 * Date:2018/7/9
 * Author:Clown
 * Desc;
 */
public interface DownPurchaseOrderRepository extends DownPurchaseOrderReadRepository, AggregateRepository<DownPurchaseOrder, Long> {

  /**
   * 重载update方法选择是否更新订单项
   * @param order 更新的采购单
   * @param isUpdateItem false：不更新订单项 true：更新订单项
   */
  void update(DownPurchaseOrder order, boolean isUpdateItem);

  /**
   * 根据商品id拿到订单明细
   *
   * @param goodsId
   * @return
   */
  DownPurchaseOrderItem getByGoodsId(Long goodsId,Long id);

  /**
   * 生成对账单
   *
   * @param order
   */
  public void generateStatement(DownPurchaseOrder order);

  /**
   * 上传单据图片
   *
   * @param order
   */
  public void upload(DownPurchaseOrder order);

  /**
   *修改订单及订单项
   * @param order
   */
  public void updateOrderAndItems(DownPurchaseOrder order);
}
